import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: '登录页面',
    component:() => import('../views/Login'),
  },
  {
    path: '/',
    name: 'Manage',
    component:() => import('../views/Manage.vue'),
    redirect: '/home',
    children: [
      {
        path: 'home',
        name: '首页',
        component:() => import('../views/Home.vue'),
      },
      {
        path: 'article',
        name: '旅游分享',
        component:() => import('../views/Article/ArticleHome.vue')
      },
      {
        path: '/article/:id',
        name: '具体文章页面',
        component:() => import('../views/Article/ArticlePage.vue')
      },
      {
        path: 'scenic',
        name: '景点首页',
        component:() => import('../views/Scenic/ScenicHome')
      },
    ]
  },
  {
    path: '/center',
    name: 'CenterManage',
    component:() => import('../views/Center/CenterManage.vue'),
    redirect: '/center/person',
    children: [
      {
        path: 'home',
        name: '创作中心首页',
        component:() => import('../views/Center/CenterHome.vue')
      },
      {
        path: 'person',
        name: '内容管理',
        component:() => import('../views/Center/PersonArticle.vue')
      }
    ]
  },
  {
    path: '/publish',
    name: '文章发布页面',
    component:() => import('../views/Center/ArticlePublish.vue')
  },
  {
    path: '/publish/:id',
    name: '文章编辑页面',
    component:() => import('../views/Center/ArticleUpdate.vue')
  },
  {
    path: '/person',
    name: 'PersonManage',
    component:() => import('../views/Person/PersonManage.vue'),
    redirect: '/person/profile',
    children: [
      {
        path: 'profile',
        name: '个人资料',
        component:() => import('../views/Person/PersonProfile')
      },
      {
        path: 'setting',
        name: '账号设置',
        component:() => import('../views/Person/PersonSetting'),
        redirect: '/person/setting',
        children: [
          {
            path: '',
            name: "账号设置",
            component:() => import('../views/Person/PersonSettingModify/PersonSettingHome')
          },
          {
            path: 'password',
            name: '修改密码',
            component:() => import('../views/Person/PersonSettingModify/PasswordModify')
          },
          {
            path: 'phone',
            name: '修改手机号',
            component:() => import('../views/Person/PersonSettingModify/PhoneModify')
          },
          {
            path: 'email',
            name: '修改邮箱',
            component:() => import('../views/Person/PersonSettingModify/EmailModify')
          },
          {
            path: 'destroy',
            name: '账号注销',
            component:() => import('../views/Person/PersonSettingModify/AccountDestroy')
          },
        ]
      },
      {
        path: 'history',
        name: '浏览历史',
        component:() => import('../views/Person/PersonHistory.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
